package com.gobrs.async.test;

import com.gobrs.async.core.config.RuleConfig;
import com.gobrs.async.core.engine.RuleThermalLoad;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

public class RuleConfigUpdate {

    // 规则热加载器
    @Autowired(required = false)
    private RuleThermalLoad ruleThermalLoad;

    /**
     * 热更新规则任务 无需启动程序， 只需要将规则交给 规则热加载器 即可完成接入
     */
    @Test
    public void updateRule(RuleConfig rule) {
        // 单任务修改
        RuleConfig r = new RuleConfig();
        r.setName("anyConditionGeneral");
        r.setContent("AService->CService->EService->GService; BService->DService->FService->HService;");
        ruleThermalLoad.load(rule);
    }
}